package com.fnst.lbook.modules.demo.service.impl;

import java.util.List;

import javax.annotation.Resource;

import com.fnst.lbook.modules.demo.dao.DemoDao;
import com.fnst.lbook.modules.demo.model.Demo;
import com.fnst.lbook.modules.demo.service.DemoService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public class DemoServiceImpl implements DemoService {
    @Resource
    private DemoDao demoDao;

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    public boolean save(Demo demo) {
	return demoDao.save(demo);
    }

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    public boolean[] save(Demo[] demos) {
	return demoDao.save(demos);
    }

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    public boolean remove(Demo demo) {
	return demoDao.remove(demo);
    }

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    public void remove(Demo[] demos) {
	demoDao.remove(demos);
    }

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    public boolean removeById(Integer id) {
	return demoDao.removeById(id);
    }

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    public void removeByIds(Integer[] ids) {
	demoDao.removeByIds(ids);
    }

    public List<Demo> findAll() {
	return demoDao.findAll();
    }

    public Demo findById(Integer id) {
	return demoDao.find(id);
    }

    public Demo[] findByIds(Integer[] ids) {
	return demoDao.find(ids);
    }

    public void flush() {
	demoDao.flush();
    }
}
